-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(apig-v1-adapter): lowercase headers #259
Conversation
Did you had any issue with the headers not being flattered? I changed to not lowercase because the headers are always lowercase when came from API Gateway V1, so for performance reasons, I just skipped the lowercase. |
Thank you for looking!
We haven't had any issues with unflattened headers, was just attempting to reuse function that was already available to ensure the lowercasing. Happy to take a another pass to limit the operations to just casing in the interest of perf.
Very interesting! This has not been our observation. After updating from v2.17.0 to v4.2.1, we noticed our services were not receiving cookies anymore which ended up being due to the header now being the capitalized |
You can just copy the adapter that you modified to your own codebase and keep the newer version of the library.
I'm fine with having back the behavior but this will require a breaking change release. If you want to merge this PR and release as a feat, you can modify this PR and create a new flag option for this adapter called |
Thanks @H4ad, Please let me know what you think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two little changes/question but looks good overall!
remove log rework lowercase request header options performance minded util function remove unneeded option assignment add some docs grammar tweaks prefer for..of loop
Thanks again @H4ad, |
LGTM, thanks for the contribution! |
Description of change
Adding back the default behavior of emulating Node.js
http
by lowercasing all request headers. Large parts of JS ecosystem assume that these headers, particularlycookie
header, can be accessed with the lowercase key.This behavior was present in past versions of the
ApiGatewayV1Adapter
so please correct me if there is good reason that this was changed, but from my perspective it appears it may have just been missed. This past PR is an example, #25.Also, potentially related to #73
Pull-Request Checklist
main
branchnpm run lint
passes with this changenpm run test
passes with this changeFixes #0000
www/docs/main
folder.index.doc.ts
.